package com.zpark.dao;

import com.zpark.pojo.Department;
import org.springframework.context.annotation.Configuration;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class DepartmentDao {
    //模拟数据库中的数据
    private static Map<Integer, Department> departments = null;
    static{
        departments = new HashMap<Integer,Department>();//创建一个部门表

        departments.put(01,new Department(01,"教学部"));
        departments.put(02,new Department(02,"市场部"));
        departments.put(03,new Department(03,"教研部"));
        departments.put(04,new Department(04,"运营部"));
        departments.put(05,new Department(05,"后勤部"));
    }
    //获得所有部门信息
    public Collection<Department> getDepartment(){
        return departments.values();
    }
    //通过部门得到部门
    public Department getDepartmentById(Integer id){
        return departments.get(id);
    }
}
